package org.example.spring.service.userServiceImpl;


import org.example.spring.domain.pojo.User;
import org.example.spring.mapper.UserMapper;
import org.example.spring.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;


    @Override
    public User getUser(String username, String password) {
        User user=userMapper.getUser(username,password);
        return user;
    }

    @Override
    public User findByUserName(String username){
        User u = userMapper.findByUserName(username);
        return u;
    }

    @Override
    public void register(User u){
        u.setPassword(u.getPassword());
        userMapper.add(u);
    }


    @Override
    public void updatePwd(User u){
        userMapper.updatePwd(u);
    }
}

